import { Module, VuexModule, Mutation } from 'vuex-module-decorators'

@Module({
  name: 'app',
  stateFactory: true,
  namespaced: true
})
export default class AppModule extends VuexModule {
  /**
   * 导航栏要显示的位置(web)
   */
  navIndex = '/'

  /**
   * 是否显示全局Loading
   */
  loading = false

  /**
   * 设置导航栏索引
   * @param state
   */
  @Mutation
  SET_NAV_INDEX (navIndex: string) {
    this.navIndex = navIndex
  }

  /**
   * 设置去哪聚loading
   * @param navIndex
   * @constructor
   */
  @Mutation
  SET_LOADING (loading: boolean) {
    this.loading = loading
  }
}
